module Documenti::LettereHelper
  def options_for_association_conditions(association)
    if association.name == :contatto
      {'contatti.contatto_ref_id' => @record.partner_id}
    else
      super
    end
  end
  def lettera_user_form_column(record, options)
    if record.user_id == nil
      select("record", "user", User.all.map {|i|
        [i.name, i.id]}, {:selected => current_user.id}, 
          :name => "record[user][id]")
    else
      select("record", "user", User.all.map {|i|
        [i.name, i.id]}, {:selected => record.user_id}, 
          :name => "record[user][id]")
    end
  end
end
